package com.ruoyi.common.enums;

public enum ThresholdType {
    RECHARGE(0, "充值门槛"),
    TURNOVER(1, "流水门槛");

    private final Integer code;
    private final String description;

    ThresholdType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据代码查找对应的门槛类型
    public static ThresholdType getByCode(Integer code) {
        for (ThresholdType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid Threshold Type code: " + code);
    }
}
